package com.sky.mapper;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.sky.entity.Employee;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

@Mapper
public interface EmployeeMapper extends BaseMapper<Employee> {

    /**
     * 根据用户名查询员工
     *
     * @param username
     * @return
     */
    @Select("select * from employee where username = #{username}")
    Employee getByUsername(String username);

    /**
     * 使用分页查询 根据用户名模糊查询用户信息
     * @param page page
     * @param wrapper 查询条件
     * @return
     */
    @Select("select* from employee ${ew.customSqlSegment}")
    IPage<Employee> pageQuery(IPage<Employee> page, @Param(Constants.WRAPPER) LambdaQueryWrapper<Employee> wrapper);
}
